package com.example.combwyaq.mvp.model;

import android.util.Log;

import com.example.combwyaq.utils.LogUtils;
import com.google.gson.Gson;

import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public abstract class BaseModel implements IModel{

    @Override
    public RequestBody createBody(Map<String, Object> map) {
        LogUtils.e("BaseModel");
        if (map==null)
            return null;
//        map转json字符串
        String s = new Gson().toJson(map);
        RequestBody body = RequestBody.create(MediaType.parse("application/json"), s);
        return body;
    }
}
